﻿namespace MonetDbDataProvider.Query
{
    using System;

    public static class Utility
    {
        public static Type GetType(string value)
        {
            switch (value)
            {
                case "tinyint":
                    return typeof(Byte);
                case "smallint":
                    return typeof(Int16);
                case "int":
                    return typeof(Int32);
                case "bigint":
                    return typeof(Int64);
                case "wrd":
                    return typeof(Int64);
                case "boolean":
                    return typeof(Boolean);
                case "char":
                    return typeof(Char);
                case "oid":
                    return typeof(object);
                case "varchar":
                    return typeof(String);
                case "double":
                    return typeof(Double);
                case "decimal":
                    return typeof(Decimal);
                case "real":
                    return typeof(float);
                case "date":
                    return typeof(DateTime);
                case "time":
                    return typeof(DateTime);
                case "timetz":
                    return typeof(DateTime);
                case "timestamp":
                    return typeof(DateTime);
                case "timestampz":
                    return typeof(DateTime);                
                case "month_interval":
                    return typeof(Int16);
                case "sec_interval":
                    return typeof(Decimal);
                default:
                    return typeof(String);
            }
        }
    }
}
